package com.jy.importclient;

import com.jy.importclient.handler.ScheduledRetrySubtaskHandler;
import com.jy.importclient.handler.ScheduledTaskHandler;
import com.jy.importclient.support.QuartzSupport;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;

import javax.annotation.Resource;

@ConfigurationPropertiesScan("com.jy.importclient.properties")
@SpringBootApplication
public class ImportclientApplication implements CommandLineRunner {

    @Resource
    private QuartzSupport quartzSupport;

    public static void main(String[] args) {
        SpringApplication.run(ImportclientApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        quartzSupport.generateSimpleScheduledTask(ScheduledTaskHandler.class, "bpk-data-pipeline-client-job", "bpk-data-pipeline-client-trigger");
        quartzSupport.generateSimpleScheduledTask(ScheduledRetrySubtaskHandler.class, "bpk-data-pipeline-client-retry-subtask-job", "bpk-data-pipeline-client-retry-subtask-trigger");
    }
}
